From 427c4f5d1c4c77b20ec64e71dfe62ee4f2d84436 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Tue, 8 Mar 2005 13:29:15 +0000 Subject: [PATCH] bitkeeper revision 1.1236.12.5 (422da8ab_AbA2_rC_i23sDg0BY_avQ) Time cleanup. Signed-off-by: Keir Fraser --- xen/arch/x86/time.c | 33 +++++++++++++++++---------------- xen/include/xen/sched.h | 3 --- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 52a086a239..0bd051954f 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -274,21 +274,13 @@ s_time_t get_s_time(void) return now; } - -void update_dom_time(struct exec_domain *ed) +static inline void __update_dom_time(struct exec_domain *ed) { struct domain *d = ed->domain; shared_info_t *si = d->shared_info; - unsigned long flags; - if ( d->last_propagated_timestamp == full_tsc_irq ) - return; - - read_lock_irqsave(&time_lock, flags); spin_lock(&d->time_lock); - d->last_propagated_timestamp = full_tsc_irq; - si->time_version1++; wmb(); @@ -302,11 +294,20 @@ void update_dom_time(struct exec_domain *ed) si->time_version2++; spin_unlock(&d->time_lock); - read_unlock_irqrestore(&time_lock, flags); - - send_guest_virq(ed, VIRQ_TIMER); } +void update_dom_time(struct exec_domain *ed) +{ + unsigned long flags; + + if ( ed->domain->shared_info->tsc_timestamp != full_tsc_irq ) + { + read_lock_irqsave(&time_lock, flags); + __update_dom_time(ed); + read_unlock_irqrestore(&time_lock, flags); + send_guest_virq(ed, VIRQ_TIMER); + } +} /* Set clock to after 00:00:00 UTC, 1 January, 1970. */ void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base) @@ -328,11 +329,11 @@ void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base) wc_sec = secs; wc_usec = _usecs; - write_unlock_irq(&time_lock); - /* Others will pick up the change at the next tick. */ - current->domain->last_propagated_timestamp = 0; /* force propagation */ - update_dom_time(current); + __update_dom_time(current); + send_guest_virq(current, VIRQ_TIMER); + + write_unlock_irq(&time_lock); } diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 061f17e501..83925b46f5 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -141,9 +141,6 @@ struct domain u16 pirq_to_evtchn[NR_PIRQS]; u32 pirq_mask[NR_PIRQS/32]; - /* Last point at which timestamp info was propagated to the guest. */ - u64 last_propagated_timestamp; - /* Physical I/O */ spinlock_t pcidev_lock; struct list_head pcidev_list; -- 2.30.2